1. Field of the Invention
The present invention relates to a digital image processing method, and more particularly to a color interpolation method for a digital image by using a Bayer pattern.
2. Related Art
In a photosensitive element, an array formed by millions of photosensitive units (or pixels) covers a surface of a transducer. Once the photosensitive element receives lights, accumulated charges on the pixel array of the entire photosensitive element is read from one end of the photosensitive element. The accumulated charges are quantified by an analog front-end chip or a photosensitive processor.
In order to present a color image accurately, each pixel position on the transducer requires three color samples, which are normally three primary colors of red, green, and blue (RGB). However, if three layers of color photosensitive elements are disposed on the same pixel position, the cost of a digital camera may be greatly increased. Therefore, a process of using a color filter array (CFA) to receive lights for the color pixels is proposed. Currently, the most commonly used CFA is a Bayer pattern. As for the color distribution in the Bayer pattern, green pixels and red pixels are arranged alternately to form one row, blue pixels and green pixels are arranged alternately to form the next row, and the green pixels and the red pixels are alternately arranged or the blue pixels and the green pixels are alternately arranged to form subsequent rows. In the Bayer pattern, each pixel only has one color value, instead of having the other color values.
FIG. 1 is a schematic view of a Bayer pattern in the prior art. Referring to FIG. 1, a Bayer pattern 100 utilizes the principle that human eyes are more sensitive in recognizing green than recognizing red or blue. Therefore, in a CFA of the Bayer pattern 100, the number of green filters is twice of that of blue or red filters, such that every four pixels form one unit. The arrangement of the filters is described as follows: in the first row, red filters and green filters are arranged alternately; and in the next row, green filters and blue filters are arranged alternately.
Finally, a digital camera processor performs a color interpolation according to the quantity of light received by each pixel. Table 1 shows a partial list of a filter array of color pixels.
TABLE 1G1R2G3R4B5G6B7G8G9R10G11R12B13G14B15G16
For example, the interpolation operation is an interpolation of green pixels at positions of blue pixels and red pixels. Referring to FIG. 1, since four surrounding pixels all have real green pixels, a missing green pixel is recovered through interpolation by using the surrounding colors.G′7=(G3+G6+G8+G11)/4,  Equation 1R′7=(R2+R4+R10+R12)/4,  Equation 2B′6=(B5+B7)/2,  Equation 3
In the above equations, G, R, and B respectively represent a real green pixel, a real red pixel, and a real blue pixel, and G′, R′, and B′ respectively represent a green pixel value, a red pixel value, and a blue pixel value obtained through interpolation.
After the colors of the above color pixels are reconstructed, color correction values of all pixels of the Bayer pattern 100 may be obtained. After compensation, Table 2 is obtained as follows, which shows a list of colors of each compensated pixel.
TABLE 2G1R′1B′1G′2R2 B′2G3R′3 B′3G′4R4B′4G′5R′5B5G6R′6B′6G′7R′7B7G8R′8B′8G9R′9B′9G′10R10 B′10G11R′11B′11G′12R12B′12G′13R′13B13G14R′14B′14G′15R′15B15G16R′16B′16
When G′7 is interpolated, only four neighboring G pixels in the upper, lower, left, and right directions are used, and important information on B7 fails to be fully utilized, thereby resulting in a poor image resolution after interpolation.